const commonConfig = require('./webpack.common')
const { merge } = require('webpack-merge')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')


module.exports = merge(commonConfig, {
    mode: 'production',
    devtool: 'nosources-source-map',
    module: {
        rules: [{
            test: /\.css$/,
            exclude: /node_module/,
            use: [
                'vue-style-loader',
                {
                    loader: 'css-loader',
                    options: {
                        modules: false
                    }
                }
            ]
        }]
    },
    optimization: {
        usedExports: true,      // 标记未引用代码
        minimize: true,         // 移除未引用代码
        splitChunks: {
            chunks: 'all'
        }
    },
    plugins: [
        new CleanWebpackPlugin()
    ]
})